reduce method for beginners